package com.zhangsun.springRabbitMq.controller;

import com.zhangsun.springRabbitMq.bean.User;
import com.zhangsun.springRabbitMq.producer.HelloProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

@RestController
public class HelloController {

    @Autowired
    private HelloProducer helloProducer;

    @RequestMapping("/hello")
    public String hello(String msg) {
        User user = new User();
        user.setUserId(UUID.randomUUID().toString());
        user.setUserName(msg);
        user.setUserNo("0001");
        helloProducer.send(user);
        return "success";
    }

}
